<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Cache-Control" content="no-store">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

<script type="text/javascript" src="${ctx}/resources/js/jquery-1.7.2.js"></script>

<script type="text/javascript">
/*
function openWindow(newUrl) {
	location.href=newUrl;  
}
window.openWindow("https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8099%2Figoogle%2FuserConfig!modifyInfo.action&response_type=code&client_id=1083338644751.apps.googleusercontent.com&approval_prompt=auto&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar+https%3A%2F%2Fmail.google.com%2Fmail%2Ffeed%2Fatom&access_type=offline");
*/

$(document).ready(function(){
	var anchor = window.location.hash;
	var values = anchor.substring(1).split("&");
	window.location.href="${ctx}/calendar!searchinfoinit.action?"+values[0];
	
});

function postRequest(){
	/*
	$.post(
		"https://accounts.google.com/o/oauth2/token",
		{
			code: 				"4%2FjqK_cgFdNodvEbb7JCAqKBtaC827.0t6ZcdHXykIZgrKXntQAax08OoyWdgI",
			client_id: 			"1083338644751.apps.googleusercontent.com",
			client_secret:		"aGU4lkCwsvbXnVnffiF3Zd8y",
			redirect_uri:		"http%3A%2F%2Flocalhost%3A8099%2Figoogle%2FuserConfig!modifyInfo.action",
			grant_type:			"authorization_code"
		},
		function(data){
			process(data);
		},
		"json"
	);
	*/
	/*
	var access_code="${access_code}";
	$.ajax({
		type: "POST",
		url: "https://accounts.google.com/o/oauth2/token",
		data: "code="+access_code+"&redirect_uri=http://localhost:8080/igoogle/login!saveInfo.action&client_id=1083338644751.apps.googleusercontent.com&client_secret=IadRbNhC9A1sifjD7qhL9xtz&grant_type=authorization_code",
		dataType: "json",
		error : function(data){
			process(data);
		}
	});
	
	window.location.href="https://www.googleapis.com/calendar/v3/calendars/micheallee98@gmail.com/events?"+values[0];
	
	$.ajax({
		type: "GET",
		url: "https://www.googleapis.com/calendar/v3/calendars/micheallee98@gmail.com/events",
		data: values[0],
		dataType: "text",
		success : function(data){
			process(data);
		}
	});
	
	function process(data){
		window.location.href="${ctx}/calendar!searchinfoinit.action?googlertn="+data;
	}
	
	*/
	
	
}


</script>
</head>
<body>
<h2>跳转中......</h2>
</body>
</html>